home *** CD-ROM | disk | FTP | other *** search
/ MacTech 1 to 12 / MacTech-vol-1-12.toast / Source / MacTech® Magazine / Volume 04 - 1988 / 04.11 Nov 88 / IAC / Editor Stuff / Editor.h < prev    next >
Encoding:
C/C++ Source or Header  |  1988-09-18  |  3.8 KB  |  143 lines  |  [TEXT/MPS ]

  1.  
  2. /*
  3.  * Resource ID constants.
  4.  */
  5. # define    appleID            128 
  6. # define    fileID             129
  7. # define    editID             130
  8. # define    optionsID        131
  9. # define    fontID            132
  10. # define    sizeID            133
  11. # define    linkDisplayID    134
  12.  
  13. /* MyMenus[] array indexes */
  14. # define    appleMenu        0
  15. # define    aboutMeCommand    1
  16.  
  17. # define    fileMenu        1
  18. # define    newCommand        1
  19. # define    openCommand        2
  20. # define    closeCommand    3
  21. # define    saveCommand        4
  22. # define    quitCommand     6
  23.  
  24. # define    editMenu        2
  25. # define    undoCommand     1
  26. # define    cutCommand        3
  27. # define    copyCommand     4
  28. # define    pasteCommand    5
  29. # define    clearCommand    6
  30. /* The IAC Commands!! */
  31. # define    hotCopyCommand    8
  32. # define    hotPasteCommand    9
  33. # define    zapLinkCommand    10
  34.  
  35. # define    optionsMenu        3
  36. # define    showLinksCmd    1
  37. # define    showLinkInfoCmd    2
  38.  
  39. # define fontMenu        4
  40.  
  41. # define sizeMenu        5
  42.  
  43. # define linkdDispMenu    6
  44.  
  45. # define menuCount        7
  46.  
  47. /* windows, dialogs, and alerts */
  48. # define windowID        128
  49. # define ABOUT_DLOG        128
  50. # define ABOUT_LINKS    129
  51. # define NO_IAC            256
  52. # define IAC_ERR_ALRT    257
  53. # define NOT_IN_EXT        258
  54. # define KILL_EXT        259
  55. # define SAVE_CHANGES    260
  56.  
  57. # define BS 0x08
  58. # define POLL_INT 60
  59. # define SLEEP 20
  60.  
  61. /* Formats supported by the IAC driver are normal resource types */
  62. # define TXT_FMT 0x54455854
  63.  
  64. /* Error codes returned by the IAC driver */
  65. # define NO_MORE_DOCS -2000
  66. # define NO_MORE_SLOTS -2001
  67. # define WRITE_FAILED -2002
  68. # define MISSING_LINK -2003
  69. # define NO_NEWER_ED -2004
  70. # define READ_FAILED -2005
  71. # define NO_SUCH_DEP -2006
  72. # define OLD_ROMS -2007
  73.  
  74. /*
  75.  *    Information records associated with a window
  76.  */
  77.  
  78. typedef struct {
  79.     long        src_doc;        /* doc_ID of source doc */
  80.     short        hat_check;        /* identifier for an extent */
  81.     short        ed_level;        /* edition for extent */
  82.     short        ext_strt;        /* start of extent range */
  83.     short        ext_end;        /* end of extent range */
  84. } extent, *extentP, *exTable, **extentH;
  85.  
  86. typedef struct {
  87.     short        the_slot;        /* slot_ID for this document */
  88.     long        doc_ID;            /* document ID for this doc */
  89.     short        ext_cnt;        /* number of extents with this doc */
  90.     short        relevent;        /* # un-updated extents */
  91.     extentH        the_extents;    /* block of extent records */
  92.     TEHandle    wind_TEH;        /* TEHandle for this window */
  93.     Boolean        dirty;            /* doc needs saving */
  94.     String(63)    doc_file_nm;    /* if null, never been saved */
  95. } win_data, *win_dataP, **win_dataH;
  96.  
  97. /****
  98.  * Global Data objects, used by routines external to main().
  99.  ***/
  100.  
  101. #ifndef PUBLIC
  102. #define PUBLIC
  103. #undef NO_INIT
  104. #else
  105. #define NO_INIT
  106. #endif
  107.  
  108. PUBLIC MenuHandle        MyMenus[menuCount];     /* The menu handles */
  109. PUBLIC Boolean             DoneFlag;                /* Becomes true when File:Quit chosen */
  110. PUBLIC TEHandle            TextH;                    /* The TextEdit handle */
  111. PUBLIC CursHandle        ibeamHdl;
  112. PUBLIC WindowPtr        myWindow;                /* the text window */
  113. PUBLIC WindowRecord        wRecord;                /* where to store the window stuff */
  114. PUBLIC win_dataH        the_data_H;                /* data associated with a window */
  115. PUBLIC short            fRef;                    /* refnum for document file */
  116. PUBLIC short            the_fNum, the_size;        /* text attributes */
  117. PUBLIC Style            the_style;
  118. PUBLIC extent            curr_ext;                /* latest extent worked on */
  119. PUBLIC short            curr_ext_no;            /* index of curr_ext */
  120. PUBLIC Boolean            ext_active;                /* Is there an active extent? */
  121. PUBLIC long                last_poll;                /* when we last polled IAC */
  122.  
  123. /*    f_sizes & f_styles are used in the menu_tree() processing and are read only */
  124.  
  125. #ifdef NO_INIT
  126. PUBLIC short            extent_count;            /* links we are target of */
  127. PUBLIC Boolean            link_menu;                /* link menu has been created */
  128. PUBLIC short            f_sizes[8];
  129. PUBLIC Style            f_styles[5];
  130. #else
  131. PUBLIC short            extent_count = 0;
  132. PUBLIC Boolean            link_menu = false;
  133. PUBLIC short            f_sizes[8] = {9, 10, 12, 14, 16, 20, 24, 28};
  134. PUBLIC Style            f_styles[5] = {bold, italic, underline, outline, shadow};
  135. #endif
  136.  
  137. /*
  138.  * HIWORD and LOWORD macros, for readability.
  139.  */
  140. # define HIWORD(aLong)        (((aLong) >> 16) & 0xFFFF)
  141. # define LOWORD(aLong)        ((aLong) & 0xFFFF)
  142.  
  143.